<script type="text/javascript" src="javascript/editableselect.js"></script>
<link rel="stylesheet" type="text/css" href="style/editableselect.css"/>
{literal}
<style type="text/css">
<!--
.buscador_label {
	font-weight: bold;
}

#mercadoC, #tipoC, #estadoC, #marcaC, #marcaA, #tipoA, #localidadC, #anioC, #anioDesdeC, #anioHastaC, #mercadoA, #jumpMenu, #modeloC, #provinciaC, #provinciaA, #provinciaS, #localidadC, #localidadA, #localidadS {
	width: 180px;
	border-style:solid;
	border-width:1px;
	border-color:#C4C5C7;
	font-family:"Trebuchet MS", Arial, Helvetica, sans-serif;
	font-size:10px;
	color:#999;
}
#mailsuscripcion {
	width: 150px;
	border-style:solid;
	border-width:1px;
	border-color:#C4C5C7;
	font-family:"Trebuchet MS", Arial, Helvetica, sans-serif;
	font-size:10px;
	height:25px;
	color:#999;
}
table.buscador_form_1, table.buscador_form_2, table.buscador_form_3 {
 	width: 100%;
}

table.buscador_form_1 td ,table.buscador_form_2 td, table.buscador_form_3 td {
	padding: 2px;
	vertical-align: top;
}
-->
</style>

<script type="text/javascript">
<!--
	jQuery(document).ready(function(){
				
		var path = ''+window.location;		
		var $tab=path.substring(path.length-6,path.length);
		if($tab=='tabs-1'){			
			$("#img1").attr("src","layout_images/new/botoncomprarform2.gif");
			$("#img2").attr("src","layout_images/new/botonalquilarform3.gif");
			$("#img3").attr("src","layout_images/new/botonserviciosform3.gif");
		}else if($tab=='tabs-2'){
			$("#img1").attr("src","layout_images/new/botoncomprarform3.gif");
			$("#img2").attr("src","layout_images/new/botonalquilarform2.gif");
			$("#img3").attr("src","layout_images/new/botonserviciosform3.gif");
		}else if($tab=='tabs-3'){
			$("#img1").attr("src","layout_images/new/botoncomprarform3.gif");
			$("#img2").attr("src","layout_images/new/botonalquilarform3.gif");
			$("#img3").attr("src","layout_images/new/botonserviciosform2.gif");	
		}
		//Mostramos las tabas ocultas ya que está creado el minibuscadorCon Tabs
		$("#tabs-2").css("display","");
		$("#tabs-3").css("display","");
		$("#li_mb_02").fadeIn('slow');
		$("#li_mb_03").fadeIn('slow');
				
	});
	


    var const_elija = "<option value=''> --- Seleccione --- </option>";	
	jQuery(function() {
		var $mytabs = jQuery("#tabs").tabs({
		    select: function(event, ui) {
		    	var $tab=ui.tab.href.substring(ui.tab.href.length-6,ui.tab.href.length);
				var $catid=-1;		    					
		    	if($tab=='tabs-1')
		    	{
			    	var id={/literal}{$smarty.const.ID_CAT_COMPRA}{literal};		
		    	}else if($tab=='tabs-2')
		    	{
		    		var id={/literal}{$smarty.const.ID_CAT_ALQUILER}{literal};
				    				
		    	}if($tab=='tabs-3')
		    	{
		    		var id={/literal}{$smarty.const.ID_CAT_SERVICIOS}{literal};
		    	}
		        location.href = 'index.php?catid='+id+'#'+$tab;		            		            
		        return false;
		    }
		});		
		setupMiniBuscador();
	});
	
	
	function setupMiniBuscador(){
		setupMiniBuscadorVenta();
		setupMiniBuscadorAlquiler();	
	}
	
	function setupMiniBuscadorServicios(){
		jQuery("#localidadS").autocomplete("search_autoCompleter.php?action=localidadJson", {
			minChars: 1, max: 20, autoFill: false, 
			selectFirst: true, mustMatch: false,
			matchContains: true, scrollHeight: 220,
			extraParams: { provincia: function() { return jQuery("#provinciaS").val();}},
			parse: parseLocalidades,
			formatItem: formatItemLocalidad
		}).result(function(e, item)	{
			$("#localidadS").val(item.localidad_full).attr("readonly",true);
		});		
	}
		
	
	function setupMiniBuscadorAlquiler(){
		
		//Added by JMR
		jQuery("#mercadoA").change(function(){
			jQuery.get("search_autoCompleter.php?action=tipoA&cat_id="+jQuery("#mercadoA").val(),{},function(data){
				jQuery("#tipoA").html(const_elija + data);			
			});
        	jQuery.get("search_autoCompleter.php?action=marca3A&cat_id="+jQuery("#mercadoA").val(),{},function(data){
				jQuery("#marcaA").html(const_elija + data);			
			});
			
		 });		
	}
		
	function setupMiniBuscadorVenta(){
		jQuery("#mercadoC").change(
			function(){
					jQuery.get("search_autoCompleter.php?action=tipoC&cat_id="+jQuery("#mercadoC").val(),{},function(data){
					jQuery("#tipoC").html(const_elija + data);
					//jQuery("#marcaC").html("");
					jQuery("#modeloC").html("");})
					//Added by JMR
					jQuery.get("search_autoCompleter.php?action=marca3C&cat_id="+jQuery("#mercadoC").val(),{},function(data){
					jQuery("#marcaC").html(const_elija + data);			
					}
					);
				}
			);	
		
		jQuery("#localidadC").change(function(){
			var tipo = jQuery("#tipoC").val();
			var marca = jQuery("#marcaC").val();
			jQuery.get("search_autoCompleter.php?action=modeloC&tipo="+tipo+"&marca="+marca,{},function(data){
				jQuery("#modeloC").html(const_elija + data);
				
			})
		});		
				
	}
	
	$(window).load(function(){ window.scroll(0,0); });
//-->	
</script>
<script type="text/javascript" language="JavaScript">
function showtab(d,d2,d3) {
if(d.length < 1) { return; }
document.getElementById("tabb1").style.display = "none";
document.getElementById("tabb2").style.display = "none";
document.getElementById("tabb3").style.display = "none";
document.getElementById("botontabb1").src = "layout_images/new/boton_comprar.jpg";
document.getElementById("botontabb2").src = "layout_images/new/boton_alquilar.jpg";
document.getElementById("botontabb3").src = "layout_images/new/boton_repuestos.jpg";
document.getElementById(d).style.display = "block";
document.getElementById(d2).src = "/layout_images/new/" + d3;
}
</script>

{/literal}


<div style="width: 286px; background-image:url(layout_images/new/fondo_buscador_mini.jpg); background-repeat:repeat-y;">
<table cellpadding="0" cellspacing="0" width="286" border="0">

<tr><td><img src="layout_images/new/boton_comprar_on.jpg" alt="Venta" title="Venta" border="0" style="cursor:pointer;" onclick="showtab('tabb1','botontabb1','boton_comprar_on.jpg')" id="botontabb1" /><img src="layout_images/new/boton_alquilar.jpg" alt="Alquiler" title="Alquiler" border="0" style="cursor:pointer;" onclick="showtab('tabb2','botontabb2','boton_alquilar_on.jpg')" id="botontabb2" /><a href="#tabs-3"><img src="layout_images/new/boton_repuestos.jpg" border="0" style="cursor:pointer;" onclick="showtab('tabb3','botontabb3','boton_repuestos_on.jpg')" id="botontabb3" /></a></td></tr>
<tr><td>
		<div id="tabb1"	name="tabb1">
        <form name="formC" id="formC" action="search.php" method="post">
			<input type="hidden" value="Buscar" name="do_search"  />
			<input type="hidden" value="1" name="Nueva"  />
			<input type="hidden" value="{$smarty.const.ID_CAT_COMPRA}" name="main_catId_mb"  />
			<table class="buscador_form_1" width="100%" border="0" cellpadding="0" cellspacing="2">
			  <tr>
				<td valign="middle" style="padding-left:26px;" align="left">Estado</td>
				<td valign="middle" align="left">
					<select name="estadoC" id="estadoC">
						<option> --- Todos --- </option>
						<option value="Nuevo">Nuevos</option>
						<option value="Usado">Usados</option>
					</select>
				</td>
			  </tr>
			  <tr>
				<td valign="middle" style="padding-left:26px;" align="left">Mercado</td>
				<td valign="middle" align="left">
					<select name="mercadoC" id="mercadoC">
						<option> --- Seleccione --- </option>
						<?php print getCategoriasVentas(); ?>
					</select>
				</td>
			  </tr>
			  <tr>
				<td valign="middle" style="padding-left:26px;" align="left">Tipo</td>
				<td valign="middle" align="left">
					<select name="catid_search" id="tipoC">
					
					</select>
				</td>
			  </tr>
			  <tr>
              	<td valign="middle" style="padding-left:26px;" align="left">Marca</td>
				<td valign="middle" align="left">
					<select name="marcaC" id="marcaC">
	
					</select>
				</td>
			  </tr>
			  <tr>
				<td valign="middle" style="padding-left:26px;" align="left">Modelo</td>
				<td valign="middle" align="left">
					<!--  select name="e_15" id="modeloC"-->
					<input type="text" name="modeloC" id="modeloC" selectBoxOptions="">			
				</td>
			  </tr>
			  <tr>
				<td valign="middle" style="padding-left:26px;" align="left">A&ntilde;o</td>
				<td valign="middle" align="left">
					{assign var='anio' value=$smarty.now|date_format:"%Y"}
					<select name="anioDesdeC" id="anioDesdeC" style="width:87px;">
						<option value="" selected="selected">Desde</option>
					{section name=foo loop=30}
						<option value="{$anio-$smarty.section.foo.iteration+1}">{$anio-$smarty.section.foo.iteration+1}</option>
					{/section}		
					</select>		
					<select name="anioHastaC" id="anioHastaC" style="width:87px;">
						<option value="" selected="selected">Hasta</option>
					{section name=foo loop=30}
						<option value="{$anio-$smarty.section.foo.iteration+1}">{$anio-$smarty.section.foo.iteration+1}</option>
					{/section}		
					</select>		


					<!--
					<select name="anioC" id="anioC">
						<option value="" selected="selected">-- Cualquier a&ntilde;o --</option>
					{section name=foo loop=30}
						<option value="{$anio-$smarty.section.foo.iteration+1}">{$anio-$smarty.section.foo.iteration+1}</option>
					{/section}		
					</select>		
					-->
				</td>
			  </tr>
			  <tr>				
				<td valign="middle" style="padding-left:26px;" align="left">{$smarty.const.EF_PROVINCIA}</td>
				<td valign="middle" align="left">
					<select name="provinciaC" id="provinciaC" {*onchange="jQuery('#localidadC').val('').removeAttr('readonly').focus()"*}>
						<option value=""> --- {$smarty.const.EF_USR_PROVINCIA} --- </option>
						<?php print getProvincias(); ?>
					</select>
				</td>
			  </tr>	
			  <!--
              <tr>
			    <td valign="middle" style="padding-left:26px;" align="left">{$smarty.const.EF_LOCALIDAD}</td>
				<td align="left">	
					<input type="text" name="localidadC" id="localidadC" size="100" />{*&nbsp;<a onclick="jQuery('#localidadC').val('').removeAttr('readonly').focus()" style="color:#333333; cursor: pointer" title="Buscar otra localidad">X</a>*}					
				</td>
			  </tr> -->
	 
			  <tr>
				<td colspan="2" align="right" style="padding-right:20px;">                
                    <input name="imageField2" type="image" src="layout_images/new/buscar_mini.jpg" align="middle" alt="Buscar" />
				  </td>
			  </tr>
			</table>
            </form>  
           </div>
    	   <div id="tabb2"	name="tabb2" style="display:none">
                <form name="formt2" id="formt2" action="search.php" method="post" >
                <input type="hidden" value="Buscar" name="do_search"  />
                <input type="hidden" value="1" name="Nueva"  />
                <input type="hidden" value="{$smarty.const.ID_CAT_ALQUILER}" name="main_catId_mb"  />		
                <table class="buscador_form_1" width="100%" border="0" cellpadding="0" cellspacing="2">
                  <tr>
                    <td valign="middle" style="padding-left:26px;" align="left">Mercado</td>
                    <td valign="middle" align="left">
                        <select name="mercadoA" id="mercadoA">
                            <option> --- Seleccione --- </option>
                            <?php print getCategoriasAlquiler(); ?>
                        </select>
                    </td>
                  </tr>
                   <tr>
                        <td valign="middle" style="padding-left:26px;" align="left">Tipo</td>
                        <td valign="middle">
                            <select name="catid_search" id="tipoA">
                            
                            </select>
                        </td>
                  </tr>
                  <tr>
                    <td valign="middle" style="padding-left:26px;" align="left">{$smarty.const.EF_PROVINCIA}</td>
                    <td valign="middle" align="left">
                        <select name="provinciaA" id="provinciaA" {*onchange="jQuery('#localidadA').val('').removeAttr('readonly').focus()"*}>
                            <option value=""> --- {$smarty.const.EF_USR_PROVINCIA} --- </option>
                            <?php print getProvincias(); ?>
                        </select>
                    </td>
                    </tr>
                   <!--
                    <tr>
                    <td valign="middle" style="padding-left:26px;" align="left">{$smarty.const.EF_LOCALIDAD}</td>
                    <td align="left">				
                        <input type="text" name="localidadA" id="localidadA" size="100" />{*&nbsp;<a onclick="jQuery('#localidadA').val('').removeAttr('readonly').focus()" style="color:#333333; cursor: pointer" title="Buscar otra localidad">X</a>*}
                    </td>
                  </tr>
                    -->    
			  <tr>
				<td colspan="2" align="right" style="padding-right:20px;">                
                    <input name="imageField2" type="image" src="layout_images/new/buscar_mini.jpg" align="middle" alt="Buscar" />
				  </td>
			  </tr>
                </table>
                
              </form>
           </div>
    	   <div id="tabb3"	name="tabb3" style="display:none">

                <form name="formt3" id="formt3" action="search.php" method="post">
                <input type="hidden" value="Buscar" name="do_search"  />
                <input type="hidden" value="1" name="Nueva"  />
                <input type="hidden" value="{$smarty.const.ID_CAT_SERVICIOS}" name="main_catId_mb"  />
                <table class="buscador_form_1" width="100%" border="0" cellpadding="0" cellspacing="2">
                  <tr>
                    <td style="padding-left:26px;" align="left">Tipo</td>
                    <td align="left"><select name="jumpMenu" id="jumpMenu">
                            <option value=""> --- Seleccione --- </option>
                            <?php print getCategoriasServicios(); ?>
                    </select></td>
                  </tr>
                  <tr>
                    <td valign="middle" style="padding-left:26px;" align="left">{$smarty.const.EF_PROVINCIA}</td>
                    <td valign="middle" align="left">
                        <select name="provinciaS" id="provinciaS" {*onchange="jQuery('#localidadS').val('').removeAttr('readonly').focus()"*}>
                            <option value=""> --- {$smarty.const.EF_USR_PROVINCIA} --- </option>
                            <?php print getProvincias(); ?>
                        </select>
                    </td>			
                  </tr>
                 <!--
                 
                  <tr>
                    <td valign="middle" style="padding-left:26px;" align="left">{$smarty.const.EF_LOCALIDAD}</td>
                    <td align="left">
                        <input type="text" name="localidadS" id="localidadS" size="100" />{*&nbsp;<a onclick="jQuery('#provinciaS').val('').removeAttr('readonly').focus()" style="color:#333333; cursor: pointer" title="Buscar otra localidad">X</a>*}
                    </td>
                  </tr>
                 -->
                  <tr>
                    <td colspan="2" align="right" style="padding-right:20px;">                
                        <input name="imageField2" type="image" src="layout_images/new/buscar_mini.jpg" align="middle" alt="Buscar" />
                      </td>
                  </tr>
                </table>
                
              </form>
                   </div>
                 

</td></tr>
<tr><td><img src="layout_images/new/pie_buscador_mini.jpg" /></td></tr>
</table>
</div>


